This post is addressed to those who believe in the Bible, including believing that the biblical book called "Daniel" was written by a prophet named Daniel in the 6th century BCE. It is not directed to my fellow atheists, though some of them might appreciate the post.
THE OXFORD COMPANION TO THE BIBLE (copyright 1993), Edited by Metzger and Coogan, has an article called "Daniel, The Book of." Note that though it uses that title for the entry of the article, it does not mean Daniel wrote the book, only that the article is referring to a book called "Daniel" (or to a the book called "Book of Daniel"). The article says the following.
"Date. The book of Daniel is one of the few books of the Bible that can be dated with precision. ...
With the possible exception of minor glosses, the book reached its present canonical form approximately in the middle of 164 BCE, though the translation of 1.1-2.42 and chaps. 8-12 from Aramaic into Hebrew may have taken later."
The article states some reasons for that view. For example it says the following.
'The lengthy apocalypse of Daniel 10-12 provides the best evidence for date and authorship. ...
The portrayal is expressed as *prophecy about the future course of events, given by a seer in Babylonian captivity; however the prevailing scholarly opinion is that this is mostly prophecy after the fact. Only from 11.39 onward does the historical survey cease accurately to reproduce the events known to have taken place in the latter years of the reign of Antiochus IV. The most obvious explanation for this shift is that the point of the writer's own lifetime had been reached. ...
According to the text of Daniel 7.9-27, the great judgment of "one like a *son of man [NRSV: human being]" ... should have occurred during the reign of Antiochus IV Epiphanes, the "little horn" with the "mouth speaking arrogantly" (7.8). Such an eschatological crisis did not, of course, happen in the reign of Antiochus. The canonizers thmeselves must have known know this; perhaps they had already reinterpreted the four beasts who rise of the sea in chap. 7 in such a way as to make Rome the fourth beast and the little horn some Roman emperor.'
The article states clues to the authorship of the book and then it says the following.
'Given these clues internal to the book, modern commentators have frequently identified the authors of Daniel and the audience to which they spoke with the observant party of the "Hasideans" or hasidim, a title variously translated "the righteous ones," 'the godly ones," or even "the saints." '